<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| H5 Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

/*------------------------------------基础数据相关-------------------------------------------*/
// 获取行政区域数据（树形）
Route::get('/v1/region/getTree', 'HomeController@getRegionTree');
// 获取物流公司列表
Route::get('/v1/express/getCompanyList', 'HomeController@getCompanyList');

/*------------------------------------会员相关-------------------------------------------*/
// 客户注册
Route::post('/v1/auth/register', 'AuthController@register');
// 客户登录
Route::post('/v1/auth/login', 'AuthController@login');
// 客户获取短信验证码
Route::post('/v1/auth/getSmsCode', 'AuthController@getSmsCode');

/*------------------------------------首页相关-------------------------------------------*/
// 初始化首页数据
Route::get('/v1/page/init', 'HomeController@init');
// 首页商品数据
Route::get('page/goods/list', 'HomeController@getGoodsList');
// 首页分类数据
Route::get('page/goodsCategory/list', 'HomeController@getCategoryList');
// 首页消息
Route::get('/v1/notice/list', 'HomeController@getNoticeList');
// 首页商品标签
Route::get('/v1/home/getTagList', 'HomeController@getTagLIst');
// 获取页面配置
Route::get('/v1/page/getSetting', 'HomeController@getSetting');

/*------------------------------------商品相关-------------------------------------------*/
// 获取分类列表（树形）
Route::get('/v1/category/list', 'GoodsController@getCategoryList');
// 获取分类详情
Route::get('/v1/category/get', 'GoodsController@getCategory');
// 获取分类详情
Route::get('/v1/goods/list', 'GoodsController@getGoodsList');

Route::middleware(['throttle:api.limiter', 'api.log', 'customer.auth'])->group(function () {
    // 获取客户信息
    Route::get('/v1/customer/get', 'CustomerController@get');
    // 获取客户财产信息
    Route::get('/v1/customer/getAssets', 'CustomerController@getAssets');
    /*------------------------------------收货相关-------------------------------------------*/
    // 收货地址列表
    Route::get('/v1/address/list', 'AddressController@getList');
    // 收货地址详情
    Route::get('/v1/address/get', 'AddressController@get');
    // 删除收货地址
    Route::post('/v1/address/delete', 'AddressController@delete');
    // 设置默认地址
    Route::post('/v1/address/setDefault', 'AddressController@setDefault');
    // 保存收货地址
    Route::post('/v1/address/update', 'AddressController@update');
    // 获取客户默认收货地址
    Route::get('/v1/address/getDefault', 'AddressController@getDefault');
    // 客户收藏列表
    Route::get('/v1//favorite/list', 'GoodsController@getFavoriteList');
    // 获取商品详情
    Route::get('/v1/goods/get', 'GoodsController@getGoods');
    // 收藏商品
    Route::post('/v1/goods/favorite/add', 'GoodsController@addFavorite');
    // 取消收藏商品
    Route::post('/v1/goods/favorite/cancel', 'GoodsController@cancelFavorite');
    // 商品搜索
    Route::get('/v1/goods/search', 'GoodsController@search');
    // 获取商品服务列表
    Route::get('/v1/service/list', 'GoodsController@getServiceList');
    // 获取商品评论
    Route::get('/v1/comment/list', 'GoodsController@getCommentList');
    // 获取商品统计
    Route::get('/v1/comment/stat', 'GoodsController@getCommentStat');
    /*------------------------------------购物车相关-------------------------------------------*/
    // 加入购物车
    Route::post('/v1/cart/add', 'CartsController@add');
    // 购物车数量统计
    Route::get('/v1/cart/total', 'CartsController@total');
    // 获取购物车
    Route::get('/v1/cart/list', 'CartsController@getList');
    // 更新购物车
    Route::post('/v1/cart/update', 'CartsController@update');
    // 删除购物车商品
    Route::post('/v1/cart/delete', 'CartsController@delete');
    // 确认订单页商品结算信息
    Route::post('/v1/cart/checkout', 'CartsController@checkout');
    /*--------------------------------优惠券相关-----------------------------*/
    // 客户优惠券列表
    Route::get('/v1/coupon/myList', 'CouponController@myList');
    // 领取优惠券
    Route::post('/v1/coupon/receive', 'CouponController@receive');
    /*--------------------------------售后相关-----------------------------*/
    // 获取售后商品信息
    Route::get('/v1/aftersales/getGoods', 'AfterSalesController@getGoods');
    // 申请售后
    Route::post('/v1/aftersales/apply', 'AfterSalesController@apply');
    // 获取售后申请列表
    Route::get('/v1/aftersales/list', 'AfterSalesController@getList');
    // 获取售后申请详情
    Route::get('/v1/aftersales/get', 'AfterSalesController@get');
    /*--------------------------------秒杀相关-----------------------------*/
    Route::post('/v1/seckill/rush', 'SecKillController@rush');
    /*--------------------------------系统相关-----------------------------*/
    // 上传文件
    Route::post('/v1/file/upload', 'FileController@upload');
    /*--------------------------------客户账户相关-----------------------------*/
    // 获取充值套餐列表
    Route::get('/v1/account/getPlanList', 'AccountController@getPlanList');
    // 账户充值
    Route::post('/v1/account/recharge', 'AccountController@recharge');
    // 账户充值记录
    Route::get('/v1/account/getRechargeLog', 'AccountController@getRechargeLog');
    /*------------------------------------订单相关-------------------------------------------*/
    // 创建订单
    Route::post('/v1/order/create', 'OrderController@create');
    // 获取订单支付信息
    Route::get('/v1/order/getPayment', 'OrderController@getPayment');
    // 支付订单
    Route::post('/v1/order/pay', 'OrderController@pay');
    // 个人中心订单统计信息
    Route::get('/v1/order/getStat', 'OrderController@getStat');
    // 订单列表
    Route::get('/v1/order/list', 'OrderController@getList');
    // 取消订单
    Route::post('/v1/order/cancel', 'OrderController@cancel');
    // 删除订单
    Route::post('/v1/order/delete', 'OrderController@delete');
    // 订单详情
    Route::get('/v1/order/get', 'OrderController@get');
    // 订单详情
    Route::get('/v1/order/stat', 'OrderController@getStat');
    // 订单确认收货
    Route::post('/v1/order/receipt', 'OrderController@receipt');
    // 订单评论
    Route::post('/v1/order/comment', 'OrderController@comment');
});
